#include <iostream>
#include <ctime>
#include <sys/time.h>
#include <cassert>
#include <unistd.h>

int main()
{
    while (1)
    {
        std::cout << "time: " << (unsigned long)time(nullptr) << std::endl;
        struct timeval currtime = {0, 0};
        int n = gettimeofday(&currtime, nullptr);
        assert(n == 0);
        (void)n;
        std::cout << "gettimeofday: " << currtime.tv_sec << "." << currtime.tv_usec << std::endl;
        sleep(1);
    }
    return 0;
}